#set lib name here!
set(LIB_NAME "ConstructionSim")

find_package(GASSSim COMPONENTS GASSEditorModule 
								GASSPluginOSG
								GASSPluginOgre								
								GASSPluginOIS 
								GASSPluginPhysX3 
								GASSPluginODE 
								GASSPluginOpenAL
								GASSPluginInput
								GASSPluginVehicle
								GASSPluginBase
								GASSPluginMyGUI)
								
set(MYGUI_DIR ${GASS_DEPENDENCIES_DIR}/MyGUI_3.2.0)
find_package(MyGUI)


#Set include directories
include_directories(${GASS_SIM_INCLUDE_DIRS} ${MYGUI_INCLUDE_DIRS})

set(CPP_FILES "main.cpp")
set(H_FILES "")
add_executable (${LIB_NAME} ${CPP_FILES} ${H_FILES})
set_target_properties(${LIB_NAME} PROPERTIES DEBUG_POSTFIX _d)

#Add project dependency libs
target_link_libraries(${LIB_NAME} ${GASS_SIM_LIBRARIES} ${MYGUI_LIBRARIES})

#install exe			

install(TARGETS ${LIB_NAME} RUNTIME DESTINATION ${CSIM_INSTALL_BIN_DIR_DEBUG} CONFIGURATIONS Debug)
install(TARGETS ${LIB_NAME} RUNTIME DESTINATION ${CSIM_INSTALL_BIN_DIR_RELEASE} CONFIGURATIONS Release)

#install config
install(FILES  ${CMAKE_CURRENT_SOURCE_DIR}/GASS.xml DESTINATION ${CSIM_INSTALL_BIN_DIR_DEBUG})
install(FILES  ${CMAKE_CURRENT_SOURCE_DIR}/GASS.xml DESTINATION ${CSIM_INSTALL_BIN_DIR_RELEASE})
#install(DIRECTORY "${OSG_DIR}/bin/osgPlugins-3.0.1" DESTINATION ${CSIM_INSTALL_BIN_DIR_DEBUG} FILES_MATCHING PATTERN "*.*" PATTERN ".svn" EXCLUDE)
#install(DIRECTORY "${OSG_DIR}/bin/osgPlugins-3.0.1" DESTINATION ${CSIM_INSTALL_BIN_DIR_RELEASE} FILES_MATCHING PATTERN "*.*" PATTERN ".svn" EXCLUDE)

#install data
install(DIRECTORY ../data DESTINATION ${CSIM_INSTALL_BIN_DIR} FILES_MATCHING PATTERN "*.*" PATTERN ".svn" EXCLUDE)

set(CSIM_BINARIES_REL ${GASS_SIM_BINARIES_REL} ${GASS_PLUGIN_BINARIES_REL} ${MYGUI_BINARIES_REL})
set(CSIM_BINARIES_DBG ${GASS_SIM_BINARIES_DBG} ${GASS_PLUGIN_BINARIES_DBG} ${MYGUI_BINARIES_DBG})


#install dlls
install (FILES  ${CSIM_BINARIES_REL} DESTINATION ${CSIM_INSTALL_BIN_DIR_RELEASE} CONFIGURATIONS Release)
install (FILES  ${CSIM_BINARIES_DBG} DESTINATION ${CSIM_INSTALL_BIN_DIR_DEBUG} CONFIGURATIONS Debug)

install(FILES ${OSGPLUGIN_BINARIES_REL} DESTINATION ${CSIM_INSTALL_BIN_DIR_RELEASE}/osgPlugins-${OSG_VERSION} CONFIGURATIONS Release)
install(FILES ${OSGPLUGIN_BINARIES_DBG} DESTINATION ${CSIM_INSTALL_BIN_DIR_DEBUG}/osgPlugins-${OSG_VERSION} CONFIGURATIONS Debug)
	
file(COPY ${CSIM_BINARIES_REL}  DESTINATION  ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/release)
file(COPY ${CSIM_BINARIES_DBG}  DESTINATION  ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/debug)
file(COPY ${OSGPLUGIN_BINARIES_REL} DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/release/osgPlugins-${OSG_VERSION})
file(COPY ${OSGPLUGIN_BINARIES_DBG} DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/debug/osgPlugins-${OSG_VERSION})

file(COPY ../data/ DESTINATION  ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/data/)
file(COPY  ${CMAKE_CURRENT_SOURCE_DIR}/GASS.xml DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/release)
file(COPY  ${CMAKE_CURRENT_SOURCE_DIR}/GASS.xml DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/debug)

